package com.example.tool;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * @author 袁小弘
 * @describe 使用GSON将JSON数据转为对象实体类
 * @date 2019-12-31 09:53
 */
public class GsonTool {

    private static volatile Gson gson;

    public static Gson getGsonInstance() {
        if (gson == null) {
            synchronized (Gson.class) {
                if (gson == null) {
//					gson = new Gson();
                    gson = new GsonBuilder().setDateFormat("yyyy-MM-dd hh:mm:ss").create();
                }
            }
        }
        return gson;
    }
}
